Fix ordering of ele on output so we pass SAXCount -f -v=always -n and
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 5 Apr 2004 13:41:01 +0000 (13:41 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 5 Apr 2004 13:41:01 +0000 (13:41 +0000)
fix misguided "leak no memory" fix so we don't mangle multiple DTD's.

gpsbabel/gpx.c

index 7807f0c86c8d2c0d896efc8a01bb582275ff8c12..4aca5e38e9ce8470fd5f8e4066a377b22fc33e26 100644 (file)
@@ -805,15 +805,22 @@ gpx_rd_init(const char *fname)
 }
 #endif
 
-static void
-gpx_rd_deinit(void)
+static 
+void 
+gpx_rd_deinit(void) 
 {
        vmem_free(&current_tag);
        vmem_free(&cdatastr);
+       /* 
+        * Don't free schema_loc.  It really is important that we preserve
+        * this across reads or else merges/copies of files with different 
+        * schemas won't retain the headers.
+        *
        if ( xsi_schema_loc ) {
                xfree(xsi_schema_loc);
                xsi_schema_loc = NULL;
        }
+       */ 
        if ( gpx_email ) {
                xfree(gpx_email);
                gpx_email = NULL;
@@ -1068,16 +1075,16 @@ gpx_waypt_pr(const waypoint *waypointp)
        if (waypointp->creation_time) {
                gpx_write_time(waypointp->creation_time, "time");
        }
+       if (waypointp->altitude != unknown_alt) {
+               fprintf(ofd, "  <ele>%f</ele>\n",
+                        waypointp->altitude);
+       }
        write_optional_xml_entity(ofd, "  ", "name", oname);
        write_optional_xml_entity(ofd, "  ", "cmt", waypointp->description);
        if (waypointp->notes && waypointp->notes[0])
                write_xml_entity(ofd, "  ", "desc", waypointp->notes);
        else
                write_optional_xml_entity(ofd, "  ", "desc", waypointp->description);
-       if (waypointp->altitude != unknown_alt) {
-               fprintf(ofd, "  <ele>%f</ele>\n",
-                        waypointp->altitude);
-       }
        if (waypointp->url) {
                tmp_ent = xml_entitize(waypointp->url);
                fprintf(ofd, "  <url>%s%s</url>\n", urlbase ? urlbase : "", tmp_ent);